package luyihan;

import java.io.FileInputStream;
import java.io.ObjectInputStream;

public class Deserialization {
    public static void main(String[] args) {
        //反序列化-user
        try {
            //打开序列化文件
            FileInputStream fileInputStream = new FileInputStream("D:\\Desktop\\11.txt");
            //反序列化
            ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
            //读取文件
           User user02 = (User) objectInputStream.readObject();

            System.out.println("反序列化成功");
            //输出反序列化后的结果
            System.out.println(user02.toString());

        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
